Package-level declarations

Types

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
value class NegativeInt constructor(val value: Int) : Comparable<NegativeInt>

Represents negative integers, including 0.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
value class NonZeroInt constructor(val value: Int) : Comparable<NonZeroInt>

Represents integers that don't equal 0.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
value class PositiveInt constructor(val value: Int) : Comparable<PositiveInt>

Represents positive integers, including 0.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
value class StrictlyNegativeInt constructor(val value: Int) : Comparable<StrictlyNegativeInt>

Represents strictly negative integers, excluding 0.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
value class StrictlyPositiveInt constructor(val value: Int) : Comparable<StrictlyPositiveInt>

Represents strictly positive integers, excluding 0.

Functions

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
infix operator fun Int.compareTo(other: NonZeroInt): Int
@SinceKotoolsTypes(version = "1.3")
infix operator fun Int.compareTo(other: PositiveInt): Int

Compares this value with the other value for order. Returns 0 if this value equals the other value, a negative number if this value is less than the other value, or a positive number if this value is greater than the other value.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.div(other: NegativeInt): Int
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.div(other: PositiveInt): Int

Divides this value by the other value, truncating the result to an integer that is closer to 0. Throws an ArithmeticException if the other value equals 0.

@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.div(other: NonZeroInt): Int
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.div(other: StrictlyNegativeInt): Int
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.div(other: StrictlyPositiveInt): Int

Divides this value by the other value, truncating the result to an integer that is closer to 0.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.minus(other: NegativeInt): Int
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.minus(other: NonZeroInt): Int
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.minus(other: PositiveInt): Int
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.minus(other: StrictlyNegativeInt): Int
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.minus(other: StrictlyPositiveInt): Int

Subtracts the other value from this value.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.plus(other: NegativeInt): Int
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.plus(other: NonZeroInt): Int
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.plus(other: PositiveInt): Int
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.plus(other: StrictlyNegativeInt): Int
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.plus(other: StrictlyPositiveInt): Int

Adds the other value to this value.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.times(other: NegativeInt): Int
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.times(other: NonZeroInt): Int
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.times(other: PositiveInt): Int
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.times(other: StrictlyNegativeInt): Int
@SinceKotoolsTypes(version = "1.1")
infix operator fun Int.times(other: StrictlyPositiveInt): Int

Multiplies this value by the other value.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
fun Int.toNegativeInt(): NegativeInt

Returns this value as a negative int, or throws an IllegalArgumentException if this value is strictly positive.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
fun Int.toNegativeIntOrNull(): NegativeInt?

Returns this value as a negative int, or returns null if this value is strictly positive.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
fun Int.toNonZeroInt(): NonZeroInt

Returns this value as a non-zero int, or throws an IllegalArgumentException if this value equals 0.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
fun Int.toNonZeroIntOrNull(): NonZeroInt?

Returns this value as a non-zero int, or returns null if this value equals 0.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
fun Int.toPositiveInt(): PositiveInt

Returns this value as a positive int, or throws an IllegalArgumentException if this value is strictly negative.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
fun Int.toPositiveIntOrNull(): PositiveInt?

Returns this value as a positive int, or returns null if this value is strictly negative.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
fun Int.toStrictlyNegativeInt(): StrictlyNegativeInt

Returns this value as a strictly negative int, or throws an IllegalArgumentException if this value is positive.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
fun Int.toStrictlyNegativeIntOrNull(): StrictlyNegativeInt?

Returns this value as a strictly negative int, or returns null if this value is positive.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
fun Int.toStrictlyPositiveInt(): StrictlyPositiveInt

Returns this value as a strictly positive int, or throws an IllegalArgumentException if this value is negative.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.1")
fun Int.toStrictlyPositiveIntOrNull(): StrictlyPositiveInt?

Returns this value as a strictly positive int, or returns null if this value is negative.